<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>党员管理</title>
<%@ include file="/module/js.jsp"%>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="idList" id="idList"/>
		<input type="hidden" id="bodyData" name="bodyData" value=""/>
		<table cellpadding="1" cellspacing="1" border="0">
				<c:if test="${_login_user_type==2}">
			<tr>
				<td><input type="button" id="btnQuery" value="查询"
					class="inputButton" /></td>
				<td>
				  <kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_KHGL_XFZS\")%>" key="add">
				<input type="button" id="btnAdd" value="添 加"
					class="inputButton" />
				 </kl:permission> 
				</td>
				<td>
				 <kl:permission permisstionList="${permisstionList}"
                    currentUser="${_login_console_user}"
                    currentCatalogId="<%=CatalogUtils.getCatalogId(\"ZHDJ_KHGL_XFZS\")%>" key="delete"> 
				<input type="button" id="btnDelete" value="删除"
					class="inputButton" />
				 </kl:permission>	
				</td>
				<td><input type="button" id="btnExport" value="导出"
					 class="inputButton"/></td>
			     <td><input type="button" id="btnGrading" value="打分项目设置"
					 class="inputButton"/></td>
			</tr>
		  </c:if>	
		</table>
	   <table cellpadding="1" cellspacing="1" >
			<tr>
				<td style="width: 10%">党支部：</td>
				<td style="width: 15%">
				  <select id="dZBID" name="dZBID" class="selectList2">
						<option value="">全部</option>
						<c:forEach items="${pList}" var="data">
							 <option value="${data.zBID}">${data.dZBMC}</option>
			            </c:forEach>
				</select>
				</td>
				<td style="width: 10%">党员类别：</td>
				<td style="width: 15%">
				  <select id="dYLB" name="dYLB" class="selectList2">
						<option value="">全部</option>
						<option value="1">正式党员</option>
						<option value="2">预备党员</option>
				</select></td>
				<td style="width: 10%">党籍状态：</td>
				<td style="width: 15%">
				 <select id="dJZT" name="dJZT" class="selectList2">
						<option value="">全部</option>
						<option value="1">正常</option>
						<option value="0">停止党籍</option>
				</select></td>
				<td style="width: 10%">性别：</td>
				<td style="width: 15%"><select id="xB" name="xB" class="selectList2">
				<option value="">全部</option>
						<option value="男">男</option>
						<option value="女">女</option>
				</select></td>
			</tr>
			
			<tr>
				<td style="width: 10%">民族：</td>
				<td style="width: 15%"><select id="mZ" name="mZ" class="selectList2">
						<option value="">全部</option>
				</select></td>
				<td style="width: 10%">学历：</td>
				<td style="width: 15%"><select id="wHCD" name="wHCD" class="selectList2">
						<option value="">全部</option>
						<option value="专科">专科</option>
						<option value="本科">本科</option>
						<option value="硕士">硕士</option>
						<option value="博士">博士</option>
						<option value="教授">教授</option>
				</select></td>
				<td style="width: 10%">学生党员：</td>
				<td style="width: 15%">
				<select id="isStu" name="isStu" class="selectList2">
						<option value="">全部</option>
						<option value="1">是</option>
						<option value="0">否</option>
				</select></td>
			</tr>
			<tr>
			    <td style="width: 10%">评定学期：</td>
				<td style="width: 15%">
				<select id="semId" name="semId" class="selectList2">
				 <option value="">全部</option>
				 <c:forEach items="${semesterList}" var="semester">
				 <option value="${semester.xqid}">${semester.xqmc}</option>
				 </c:forEach>
				</select>
			    </td>
				<td style="width: 10%">姓名：</td>
				<td style="width: 15%"><input type="text" name="xM" id="xM"   autocomplete="off" class="inputText2" /></td>
			</tr>
		</table>	
	<table id="dg"  style="width:100%;"
		data-options="pagination:true,collapsible:true,url:'${basePath}/dyxfzs/getListData',method:'post',remoteSort:true">
		<thead>
			<tr>
				<th data-options="field:'zSID',checkbox:true,width:60,align:'center'"></th>
			    <th data-options="field:'xM',sortable:true,nowrap:true,width:80,align:'center',formatter:xM,formatter:formater">姓名</th>
				<th data-options="field:'xB',sortable:true,nowrap:true,width:60,align:'center',formatter:xB">性别</th>
			    <th data-options="field:'gH',sortable:true,nowrap:true,width:60,align:'center',formatter:gH">工号</th>
				<th data-options="field:'dZBID',sortable:true,nowrap:true,width:150,align:'center',formatter:dZBID">所在党支部</th>
			    <th data-options="field:'XQMC',sortable:true,nowrap:true,width:160,align:'center'">评定学期</th>
			    <th data-options="field:'totalScore',nowrap:true,width:100,align:'center',sortable:true">分数</th>
			    <th data-options="field:'dYLB',sortable:true,nowrap:true,width:100,align:'center',formatter:dYLB">党员类别</th>
				<th data-options="field:'dJZT',sortable:true,nowrap:true,width:100,align:'center',formatter:dJZT">党籍状态</th>
			    <th data-options="field:'sFZH',sortable:true,nowrap:true,width:160,align:'center',formatter:sFZH">身份证号</th>
			    <th data-options="field:'wHCD',sortable:true,nowrap:true,width:120,align:'center',formatter:wHCD">学历</th>
				<th data-options="field:'mZ',sortable:true,nowrap:true,width:120,align:'center',formatter:mZ">民族</th>
			    <th data-options="field:'lXDH',sortable:true,nowrap:true,width:130,align:'center',formatter:lXDH">联系电话</th>
			</tr>
		</thead>
	</table>
	</form>
    <script>
        
    function formater(value, row, index) {
		return "<a href='${basePath}/dyxfzs/edit?zSID=" + row.zSID + "'>"+ row.partyLeagueMember.xM + "</a>";
	}
    
	  //格式化部门名称
	   function xM(val,row,index){
			 return row.partyLeagueMember.xM;	    
		} 
	    function xB(val,row,index){
			 return row.partyLeagueMember.xB; 				    
		} 
		 function gH(val,row,index){
			 return row.partyLeagueMember.gH; 				    
		} 
		 function dZBID(val,row,index){
			 return row.partyLeagueMember.partyBranch.dZBMC;		
		 }
		 function semId(val,row,index){
			 return row.semId;
		 }
		 function dYLB(val,row,index){
			 if(row.partyLeagueMember.dYLB == '1') {
				 return "正式党员"; 						 
			 } else if(row.partyLeagueMember.dYLB == '2') {
				 return "预备党员";
			 }
		} 
		 function dJZT(val,row,index){
			 if(row.partyLeagueMember.dJZT == '1') {
				 return "正常"; 						 
			 } else if(row.partyLeagueMember.dJZT == '0') {
				 return "停止党籍";
			 }
		} 
		 function sFZH(val,row,index){
			 return row.partyLeagueMember.sFZH; 				    
		} 
	
		 function wHCD(val,row,index){
			 return row.partyLeagueMember.wHCD; 				    
		} 
		 function mZ(val,row,index){
			 return row.partyLeagueMember.mZ; 				    
		} 
		 function lXDH(val,row,index){
			 return row.partyLeagueMember.lXDH; 				    
		} 
	  
	    function formatDate(value){
	    	var date=new Date(value);
			var y = date.getFullYear();
			var m = date.getMonth()+ 1;
			var d = date.getDate();
			var h= date.getHours();       //获取当前小时数(0-23)
			var mm= date.getMinutes();     //获取当前分钟数(0-59)
			var s= date.getSeconds();     //获取当前秒数(0-59)
			return y +'-'+(m <10?('0'+ m):m)+'-'+(d <10?('0'+ d):d)+' :'+(h <10?('0'+ h):h)+':'+(mm <10?('0'+ mm):mm)+':'+(s <10?('0'+ s):s);
		}
    
     </script>
		 <script type="text/javascript">
			$(document).ready(function() {
				 var nations = ["汉族","蒙古族","回族","藏族","维吾尔族","苗族","彝族","壮族","布依族","朝鲜族","满族","侗族","瑶族","白族","土家族",
					        "哈尼族","哈萨克族","傣族","黎族","傈僳族","佤族","畲族","高山族","拉祜族","水族","东乡族","纳西族","景颇族","柯尔克孜族",
					        "土族","达斡尔族","仫佬族","羌族","布朗族","撒拉族","毛南族","仡佬族","锡伯族","阿昌族","普米族","塔吉克族","怒族", "乌孜别克族",
					        "俄罗斯族","鄂温克族","德昂族","保安族","裕固族","京族","塔塔尔族","独龙族","鄂伦春族","赫哲族","门巴族","珞巴族","基诺族"];
				    var nation = $("#mZ");
				    for ( var i=0;i<nations.length;i++) {
				        var a=nations[i];
				     /*    console.log(nations[i]); */
				        nation.append("<option value='"+a+"'>"+a+"</option>");
				    }
	            $('#dg').datagrid({
				   rowStyler: function(index,row){
				   },
				   onLoadSuccess : function(data) {//加载完毕后获取所有的checkbox遍历
						if (data.rows.length > 0) {
						}
					},
				});
					// 添加				
				$('#btnAdd').click(function() {
					   window.location.href = "${basePath}/dyxfzs/preadd";
				});	
					
					
				// 打分项目设置				
				$('#btnGrading').click(function() {
				    window.location.href = "${basePath}/dyxfzs/gradelist";
				});		
					//查询
				$('#btnQuery').click(function() {
					$('#dg').datagrid('load',{
						dZBID: $('#dZBID').val(),
						dYLB: $('#dYLB').val(),
						dJZT: $('#dJZT').val(),
						xB: $('#xB').val(),
						mZ: $('#mZ').val(),
						wHCD: $('#wHCD').val(),
						isStu: $('#isStu').val(),
						xM: $('#xM').val(),
						semId :$('#semId').val(),
					});
				});
					// 删除
				$('#btnDelete').click(function() {
				    	$("#idList").val("");
					    var count = 0;
						var idList = new Array();
					    var sels = $("#dg").datagrid("getSelections");
				    	for(var i in sels){
				    		idList.push(sels[i].zSID);
				    		count++;
				    	}
						if (count == 0) {
							layer.alert("您至少选择一条删除记录信息", {icon: 3});
							return false;
						}else{
							  layer.confirm("您是否删除当前选中数据信息", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
								    $("#idList").val(idList);
								    document.Form.action = "${basePath}/dyxfzs/delete";
									document.Form.submit();
							  },function(index){
									layer.close(index);
							  });
						}
					});
		     	});
				 if("${msg}"!=""){
				       layer.alert("${msg}", {icon: 6});
				 } 
				$('#btnExport').on('click', function(){
					   layer.confirm("您确定要导出吗?", function(index){
						   //var rows = $("#dg").datagrid("getRows"); {icon: 3, title:'提示',skin:'layer-ext-moon'},
						  // var bodyData = JSON.stringify(rows);  //转成json字符串
						   // $("#bodyData").val(JSON.stringify(rows));
							    document.Form.action = "${basePath}/dyxfzs/export_dzb";
								document.Form.submit();
								layer.close(index);
	            		 });
					});
	 </script>
</body>
</html>
